/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Shuvo
 */
public class DataList {

    public static List<String> streams = new ArrayList<String>();
    public static List<String> subjects = new ArrayList<String>();
    public static List<String> years = new ArrayList<String>();

    static {
        try {
            Connection con = DBConnection.getConn();
            if (con != null) {
                Statement stmt = con.createStatement();
                ResultSet rs = stmt.executeQuery("SELECT * FROM STREAM");
                while (rs.next()) {
                    streams.add(rs.getString(1));
                }
                rs = stmt.executeQuery("SELECT * FROM SUBJECTS ORDER BY SUBJECT_NAME");
                while (rs.next()) {
                    subjects.add(rs.getString(1));
                }
                rs = stmt.executeQuery("SELECT * FROM YEAR");
                while (rs.next()) {
                    years.add(rs.getString(1));
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
